/* (PARI) R. J. Cano Mar 5 2016 */

/*
 
Conjecture:

  For any pair of positive integers "x" and "y"
  the number "x^y" is "x (mod 10)" {if} "y"
  has either the form:
  
  "(4*p+1)^q" with odd "q",
  
  Or the form:
  
  "(2*p+1)^q" with even "q",
  
  for positive integers p and q;

Please notice there at the previous statement: If we replace {if} with {if and only if} then x=1 is a counterexample in the sense it holds for any y ( Contribution from: Maximilian Hasler on 14:48, 5 March 2016 (UTC) );
  
*/

f=(i,j)->(2*(1+j%2)*i+1)^j;

/* Must return zero, if the conjecture "is true"
 * 
 * (this is, at least true for certain set of
 *  particular cases specified below by M and N).
 */
test00(M=10,N=5)=sum(i=1,M,sum(j=1,N,(i^f(i,j)-i)%5));

/* Sample execution.
                                                GP/PARI CALCULATOR Version 2.7.5 (released)
                                         i686 running linux (ix86/GMP-5.0.5 kernel) 32-bit version
                                              compiled: Jan 24 2016, gcc version 4.7.2 (GCC) 
                                                         threading engine: single
                                            (readline v5.2 enabled, extended help not enabled)

                                                  Copyright (C) 2000-2015 The PARI Group

PARI/GP is free software, covered by the GNU General Public License, and comes WITHOUT ANY WARRANTY WHATSOEVER.

Type ? for help, \q to quit.
Type ?12 for how to get moral (and possibly technical) support.

parisize = 1024000000, primelimit = 500000
? #
   timer = 1 (on)
? test00()
0
time = 1min, 40,802 ms.
? 
 
*/